package business.impl;

import java.util.List;

import model.TAuthorityB;
import model.TPractice;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.AuthorityDao;

public class AuthorityDaoImpl implements AuthorityDao {
	
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public TAuthorityB getAuthorityById(int id) {
		TAuthorityB title = (TAuthorityB) bdao.findById(TAuthorityB.class,id);
		return title;
	}

	@Override
	public int addAuthority(TAuthorityB model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upAuthority(TAuthorityB model) {
		return bdao.update(model);
	}

	@Override
	public boolean delAuthority(int id) {
		return bdao.delete(TAuthorityB.class, id);
	}

	@Override
	public List<TAuthorityB> getAuthoritys() {
		String sql = " from TAuthorityB where ";
		List<TAuthorityB> modl = bdao.select(sql);
		return modl;
	}

}
